define(['framework/constant'], function (constant) {
    var interviewService = ['$http', 'API_URL', function ($http, API_URL) {
        /**
         * 添加面试题
         * @param user
         * @returns {*}
         */
        this.addInterview = function (model) {
            var req = {
                method: 'post',
                url: API_URL.USER_SERVER + "/core/interview",
                data: model
            };
            return $http(req);

        }

        /**
         * 查询所有面试题
         */
        this.getInterviews = function (pageSize, currentPage) {
            var req = {
                method: 'get',
                url: API_URL.USER_SERVER + "/core/interviews",
                params: {
                    pageSize: pageSize,
                    currentPage: currentPage
                }
            };
            return $http(req);
        }

        /**
         * 删除面试题
         */
        this.deleteInterview = function (id) {
            var req = {
                method: 'delete',
                url: API_URL.USER_SERVER + "/core/interview/" + id
            };
            return $http(req);
        }

        /**
         * 更新用户信息
         */
        this.updateUser = function (user) {
            var req = {
                method: 'put',
                url: API_URL.USER_SERVER + "/core/user/" + user.id,
                data: user
            };
            return $http(req);

        }
    }];

    //引用框架定义的方法
    angular.module("interview").registerService("interviewService", interviewService);
})